package core.mountedWeapons;

import core.Player;
import core.weapons.Attack;

public abstract class MountedWeapon {
	protected int ammo=0;
	protected int maxAmmo=0;
	protected boolean usesAmmo = true;
	protected boolean autoScrap = false;
	protected String name;
	protected int cooldownTimer=0;
	protected int cooldown=10;
	protected int range;
	//protected Attack AttackBlueprint = null;
	
	public void nextFrame(){
		cooldownTimer--;
	}
	
	/**
	 * Overwrite for every weapon.
	 * @param startX
	 * @param startY
	 * @param dir
	 * @param p
	 */
	public void fire(int startX, int startY, double dir, Player p){
		
	}
	
	public boolean isReadyToFire(){
		if(cooldownTimer<=0 &&
			(ammo>0 || !usesAmmo )){
			return true;
		}
		return false;
	}
	public boolean isReadyToScrap(){
		if(autoScrap && ammo<=0)
			return true;
		else
			return false;
		
	}

	public int getRange() {
		return range;
	}

	public void setRange(int range) {
		this.range = range;
	}
}
